<html>
<head><meta charset="utf-8"><title>Reproducing an LLVM crash with LLC · t-compiler/wg-llvm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/index.html">t-compiler/wg-llvm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html">Reproducing an LLVM crash with LLC</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247383288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247383288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247383288">(Jul 27 2021 at 20:00)</a>:</h4>
<p>I'm trying to reproduce a crash in <code>RegAllocFast</code> that occurs when building with <code>-Clto=fat</code> (<a href="https://github.com/rust-lang/rust/issues/83854">https://github.com/rust-lang/rust/issues/83854</a>). I've used <code>--emit=llvm-ir</code> to get rust to dump the LLVM IR right before it makes the call which ends up triggering the crash (LLVMRustWriteOutputFile). However, I'm unable to reproduce the crash using a locally-built <code>llc</code> on the IR file</p>



<a name="247383543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247383543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247383543">(Jul 27 2021 at 20:02)</a>:</h4>
<p>Using <code>-debug-pass=Structure</code>, I've verified that the LLVM passes being used are virtually identical between LLC and Rust</p>



<a name="247383660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247383660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247383660">(Jul 27 2021 at 20:03)</a>:</h4>
<p>(the order of 'Target Transform Information' and 'Target Library Information' is different)</p>



<a name="247384579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247384579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Popov <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247384579">(Jul 27 2021 at 20:11)</a>:</h4>
<p>I'd try explicitly passing -O3 (assuming that's the level you want) and -emit=obj (which sometimes makes a difference, but probably not for a regalloc issue).</p>



<a name="247385329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247385329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247385329">(Jul 27 2021 at 20:17)</a>:</h4>
<p>Nvm, figured it out - rustc was telling llvm to generate PIC code, while llc was not</p>



<a name="247385387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Reproducing%20an%20LLVM%20crash%20with%20LLC/near/247385387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Reproducing.20an.20LLVM.20crash.20with.20LLC.html#247385387">(Jul 27 2021 at 20:18)</a>:</h4>
<p>adding '-relocation-model=pic' allows me to reproduce the issue with just LLC and a bitcode file</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>